package com.gonsin.gmessage.example.receiver;

import com.gonsin.gmessage.annotations.GArgsParam;
import com.gonsin.gmessage.annotations.GMessageReceiver;
import com.gonsin.gmessage.annotations.GZoom;
import com.gonsin.gmessage.example.po.S10000NStatusDto;
import com.gonsin.gmessage.example.po.S30000UnitPo;
import com.gonsin.gmessage.example.po.TestMessagePo;
import com.gonsin.gmessage.example.po.TestNumberObj;
import com.gonsin.gmessage.logic.model.TerminalInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Slf4j
public class DemoReceiver {

    /**
     * 接收器示例
     */
    @GMessageReceiver(firstCmd = "test", subCmd = "sub_test")
    public void receiverTest(
            @GZoom String roomKey,
            @GArgsParam(value = "message", note = "消息") TestMessagePo message,
            @GArgsParam(value = "sender", note = "发送人", demo = "邓某") String sender,
            @GArgsParam(value = "number", note = "数字", demo = "邓某") int value) {

        log.info("接收到 {}, {}, {}, {}", roomKey, message, sender, value);

    }

    /**
     * 接收Terminal信息
     * terminal信息只有终端发起的请求时候，才有信息
     */
    @GMessageReceiver(firstCmd = "test", subCmd = "mic_state")
    public void terminalTest(
            @GZoom String roomKey,
//            @GArgsParam(value = "testList", note = "测试字符串数组") List<String> testList,
            @GArgsParam(value = "testList", note = "测试字符串数组") String[] testList,
//            @GArgsParam(value = "unit_tl", note = "发言模式（具体查看枚举 micMode）") List<S30000UnitPo> micStateChangeList,
            @GArgsParam(value = "unit_tl", note = "发言模式（具体查看枚举 micMode）") S30000UnitPo[] micStateChangeList,

            /**直接在接收方法里增加 TerminalInfo 类型的参数就可以接收terminal信息**/
            TerminalInfo terminalInfo
    ) {

        log.info("接收到1 {}, {}, {}", roomKey, testList, micStateChangeList);

    }

    /**
     * 接收Terminal信息
     * terminal信息只有终端发起的请求时候，才有信息
     */
    @GMessageReceiver(firstCmd = "test", subCmd = "mic_state")
    public void terminalTest2(
            @GZoom String roomKey,
//            @GArgsParam(value = "testList", note = "测试字符串数组") List<String> testList,
            @GArgsParam(value = "testList", note = "测试字符串数组") String[] testList,
//            @GArgsParam(value = "unit_tl", note = "发言模式（具体查看枚举 micMode）") List<S30000UnitPo> micStateChangeList,
            @GArgsParam(value = "unit_tl", note = "发言模式（具体查看枚举 micMode）") S30000UnitPo[] micStateChangeList,

            /**直接在接收方法里增加 TerminalInfo 类型的参数就可以接收terminal信息**/
            TerminalInfo terminalInfo
    ) {

        log.info("接收到2 {}, {}, {}", roomKey, testList, micStateChangeList);

    }

    @GMessageReceiver(firstCmd = "commit", subCmd = "meeting_start_notice")
    public void onMeetingStart(@GArgsParam(value = "conferenceName", note = "会议名称") String conferenceName,
                               @GArgsParam(value = "commitKey", note = "commitKey") String commitKey,
                               @GArgsParam(value = "conferenceKey", note = "conferenceKey") String conferenceKey) {

    }

    @GMessageReceiver(firstCmd = "commit", subCmd = "meeting_start_notice2")
    public void onMeetingStart2(@GArgsParam(value = "conferenceName", note = "会议名称") String conferenceName,
                                @GArgsParam(value = "commitKey", note = "commitKey") String commitKey,
                                @GArgsParam(value = "conferenceKey", note = "conferenceKey") String conferenceKey) {

    }

    @GMessageReceiver(firstCmd = "commit", subCmd = "meeting_start_notice3")
    public void onMeetingStart3(@GArgsParam(value = "conferenceName", note = "会议名称") String conferenceName,
                                @GArgsParam(value = "commitKey", note = "commitKey") String commitKey,
                                @GArgsParam(value = "conferenceKey", note = "conferenceKey") String conferenceKey) {

    }

    @GMessageReceiver(firstCmd = "commit", subCmd = "meeting_start_notice4")
    public void onMeetingStart4(@GArgsParam(value = "conferenceName", note = "会议名称") String conferenceName,
                                @GArgsParam(value = "commitKey", note = "commitKey") String commitKey,
                                @GArgsParam(value = "conferenceKey", note = "conferenceKey") String conferenceKey) {

    }

    @GMessageReceiver(firstCmd = "test", subCmd = "number")
    public void testNumber(@GArgsParam(value = "obj", note = "x") S10000NStatusDto obj) {
        System.out.println(obj);
    }
}
